<template>
  <a-modal title="查询营收数据" style="top: 100px;" :visible="isShow" width="600px" @ok="handleOk" @cancel="handleCancel"
    okText="查询">
    <IForm :formFrame="frame" class="form-container" :formData.sync="form"></IForm>
    <span>注册人数 {{info.a}} 个</span></br>
    <span>总消费人数 {{info.b}} 个</span></br>
    <span>总消费 {{info.aall / 100}} 元</span></br>
    <span>当日消费人数 {{info.c}} 个</span></br>
    <span>当日消费 {{info.a0 / 100}} 元</span></br>
    <span>次日消费 {{info.a1 / 100}} 元</span></br>
    <span>次日复购率 {{info.b1}} %</span></br>
    <span>7日内消费 {{info.a2 / 100}} 元</span></br>
    <span>7日内复购率 {{info.b2}} %</span></br>
    <span>30日内消费 {{info.a3 / 100}} 元</span></br>
    <span>30日内复购率 {{info.b3}} %</span></br>
    <span>当日指用户注册时间+24小时内,7日内表示用户注册时间+24小时至24小时*7,次日和7日等都是针对当日有消费的用户, 以此类推。</span>
    </br></br></br>

     <span>以下的7日和30日从首日0点计算</span></br>
     <span>7日内总消费 {{info.c2 / 100}} 元</span></br>
     <span>7日内总利润 {{info.d2 / 100}} 元</span></br>
     <span>30日内总消费 {{info.c3 / 100}} 元</span></br>
     <span>30日内总利润 {{info.d3 / 100}} 元</span></br>
  </a-modal>
</template>
<script>
  import IForm from "@/components/IForm"

  export default {
    components: {
      IForm
    },
    props: {
      isShow: {
        type: Boolean
      }
    },
    computed: {
      frame() {
        return [
          {
            title: '注册时间(始)',
            key: 'time',
            type: 'date',
            showTime: false,
            required: true,
          },
          {
            title: '广告账号',
            key: 'adv_account',
            type: 'select',
            span: 20,
            options: this.adv_list
          },
      
        ]
      }
    },
    data() {
      return {
        form: {
         
        },
        itemTotal: 0,
        info:{
          a: 0,
          b: 0,
          a0: 0,
          b0: 0,
          a1: 0,
          b1: 0,
          a2: 0,
          b2: 0,
          a3: 0,
          b3: 0,
          aall: 0,
          ball: 0,
        },
        adv_list: []
      }
    },
    watch: {

    },
    mounted () {
      this.$http.get('/advdy').then(res => {
        this.adv_list = res.data.list
        this.adv_list = this.adv_list.map(item => {
          return {
            title: item.title,
            value: item.account_id
          }
        })
      })
    },
    methods: {
      handleOk() {
        this.$http.post('/dy-total-search/user', this.form).then(res => {
           this.info = res.data
        })
      },

      handleCancel() {
        this.$emit('hide')
      }
    }
  }
</script>
<style lang="scss" scoped>
  .tips {
    color: gray;
    font-size: 80%;
  }
</style>
